package l1j.opqlo.NewSystem.鑑定系統.StstusAdd;

import l1j.opqlo.NewSystem.鑑定系統.IdentifiedModel;
import l1j.server.server.model.Instance.L1ItemInstance;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_ItemStatus;
import l1j.server.server.utils.Random;

public class AddStoneDice extends IdentifiedModel {

	private static AddStoneDice _instance;

	public static AddStoneDice get() {
		if (_instance == null) {
			_instance = new AddStoneDice();
		}
		return _instance;
	}

	@Override
	public void setStatus(final L1PcInstance pc, final L1ItemInstance item,
			final int min, final int max) {

		final int value;
		if (max > 0) {
			value = Random.nextInt(max - min) + min;
		} else {
			value = 0;
		}

		item.setStoneDice(value);

		this.executeUpdate(item.getId(),
				"UPDATE character_items SET 石化= ? WHERE id = ?", value);

		pc.sendPackets(new S_ItemStatus(item));

	}

}
